﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Yoshizawa;

namespace Demo
{
    public partial class Form1 : Form
    {
        private FormValidator fv;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.fv = new FormValidator(this);

            this.fv.Add(
                this.textBox1,
                (control) => control.Text,
                (value) => BuiltinValidator.Required(value));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.fv.Validate())
            {
                MessageBox.Show("OK");
            }
            else
            {
                MessageBox.Show("NG");
            }
        }
    }
}
